<script language='JavaScript'>
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;   
    if((tecla>47 && tecla<58)) return true;
    else{
    	if (tecla==8 || tecla==0) return true;
	else  return false;
    }
}

function valida() {
	solicitante = document.form1.solicitante.value;
	servico = document.form1.servico.value;
	matricula = document.form1.matricula.value;
	cargo = document.form1.cargo.value;
	email = document.form1.email.value;
	setor = document.form1.setor.value;
	ramal = document.form1.ramal.value;
	reparo = document.form1.reparo.value;
	descricao = document.form1.descricao.value;
	
	if(solicitante==""){
		alert("Por favor, preencha o campo solicitante.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(matricula==""){
		alert("Por favor, preencha o campo de matrícula.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(matricula.length < 7){
		alert("Atenção: Matrícula inválida.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	/*else if(data==0000-00-00){
		alert("Por favor, preencha a data.");
		document.forms['form1'].onsubmit = function(){return false;};
	}*/
	else if(cargo==""){
		alert("Por favor, preencha o cargo.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(email==""){
		alert("Por favor, preencha o email.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(setor==""){
		alert("Por favor, preencha o setor.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(ramal==""){
		alert("Por favor, preencha o ramal.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(servico=="") {
		alert("Por favor, selecione o tipo de serviço.");
		document.forms['form1'].onsubmit = function(){return false;}; 
	}
	else if(reparo==""){
		alert("Por favor, preencha o local de reparo.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else if(descricao==""){
		alert("Por favor, preencha a descrição.");
		document.forms['form1'].onsubmit = function(){return false;};
	}
	else{
		document.forms['form1'].onsubmit = function(){return true;};
	}
}

function limpaForm(){
	document.form1.solicitante.value = "";
	document.form1.servico.value = "";
	document.form1.matricula.value = "";
	document.form1.cargo.value = "";
	document.form1.email.value = "";
	document.form1.setor.value = "";
	document.form1.ramal.value = "";
	document.form1.descricao.value = "";
}
</script>
<?php
$agent = strtolower($_SERVER["HTTP_USER_AGENT"]);
if(!strstr($agent, "firefox") && !strstr($agent, "msie")) {
	// Mostra seu conteudo 
} else {
	// Erro navegador FireFox ou IE bloquedao ...
	header('location:bloqueia_firefoxie.php');
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
	
	<script language="JavaScript">
		window.onload = function(){
		document.form1.solicitante.value = "";
		document.form1.servico.value = "";
		document.form1.matricula.value = "";
		document.form1.cargo.value = "";
		document.form1.email.value = "";
		document.form1.setor.value = "";
		document.form1.ramal.value = "";
		document.form1.reparo.value = "";
		document.form1.descricao.value = "";
	}
	</script>

	
  <meta charset="utf-8">
  <title>Requerimento de Solicitação de Serviço</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="">
  <meta name="author" content="">
	
	<link href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/style.css" rel="stylesheet">

  <!-- Fav and touch icons -->
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/apple-touch-icon-144-precomposed.png">
  <link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/apple-touch-icon-114-precomposed.png">
  <link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/apple-touch-icon-72-precomposed.png">
  <link rel="apple-touch-icon-precomposed" href="img/apple-touch-icon-57-precomposed.png">
  <link rel="shortcut icon" href="img/favicon.ico">
  
	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
</head>

<body>
<div class="panel panel-default">
				<div class="panel-heading">
					<h3 class="panel-title">
						<span class="glyphicon glyphicon-user"></span> <strong>Solicitação de Serviços</strong>
					</h3>
				</div>
				<div class="panel-body">
			<form role="form" class="form-horizontal" method="POST" name="form1" action="controller/controller.php" onsubmit="return limpaForm();">
			
				<input type="hidden" name="acao" value="incluir">			
				
				<div class="form-group">
					<label class="col-sm-2 control-label">Solicitante</label>
					<div class="col-sm-7">
						<input type="text" class="form-control" name="solicitante" maxlength="100" />
					</div>
					<label class="col-sm-1 control-label">Matrícula</label>
					<div class="col-sm-2">
						<input type="text" class="form-control" name="matricula" maxlength="8" onkeypress='return SomenteNumero(event)'>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">Cargo</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" name="cargo" maxlength="50">
					</div>
					<label class="col-sm-1 control-label" for="exampleInputEmail1">Email</label>
					<div class="col-sm-6">
						<input type="email" class="form-control" id="exampleInputEmail1" name="email" />
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">Setor</label>
					<div class="col-sm-3">
						<input type="text" class="form-control" name="setor" maxlength="50">
					</div>
					<label class="col-sm-1 control-label">Ramal</label>
					<div class="col-sm-6">
						<input type="text" class="form-control" name="ramal" maxlength="4" onkeypress='return SomenteNumero(event)'/>
					</div>
				</div>
				<div class="form-group ">
					<label class="col-sm-2 control-label">Serviço requerido:</label>
					<div class="col-sm-1 control-label">
						<input type="radio" name="servico" id="carpintaria" value="carpintaria">
					</div>
					<div class="col-sm-1 control-label">
						<label for="carpintaria">Carpintaria</label>
					</div>
					<div class="col-sm-1 control-label">
						<input type="radio" name="servico" id="eletricista" value="eletricista">
					</div>
					<div class="col-sm-1 control-label">
						<label for="eletricista">Eletricista</label>
					</div>
					<div class="col-sm-1 control-label">
						<input type="radio" name="servico" id="oficina" value="oficina">
					</div>
					<div class="col-sm-1 control-label">
						<label for="oficina">Oficina</label>
					</div>
				</div>
				<div class="form-group">
					<div class="col-sm-3 control-label">
						<input type="radio" name="servico" id="encanador" value="encanador">
					</div>
					<div class="col-sm-1 control-label">
						<label for="encanador">Encanador</label>
					</div>
					<div class="col-sm-1 control-label">
						<input type="radio" name="servico" id="pedreiro" value="pedreiro">
					</div>
					<div class="col-sm-1 control-label">
						<label for="pedreiro">Pedreiro</label>
					</div>
					<div class="col-sm-1 control-label">
						<input type="radio" name="servico" id="servico_geral" value="serviços gerais">
					</div>
					<div class="col-sm-1 control-label">
						<label for="oficina">Serviços Gerais</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">Local do Reparo</label>
					<div class="col-sm-10">
						<input type="text" class="form-control" name="reparo" maxlength="50">
					</div>
				</div>
				<div class="form-group">
					<label class="col-sm-2 control-label">Descrição</label>
					<div class="col-sm-10">
						<textarea name="descricao" type="text" class="form-control" maxlength="300"></textarea>
					</div>
				</div>
				<div class="form-group col-sm-3 text-center">
					<button type="submit" class="btn btn-success"  onClick="valida();">Solicitar</button>
				</div>
			</form>
	</div>
	<div class="panel-footer">
					<small><p class="text-right text-muted">Desenvolvido pela <a href="http://www.ifsertao-pe.edu.br/dgti" target="_blank" title="Coordenação de Tecnologia da Informação">CTI</a></p></small>
	</div>
	</div>
</div>
</body>
</html>
